<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::get('/',function(){
	return redirect("/login");
});
//注册页面
Route::get('/register','RegisterController@index');
//注册行为
Route::post('/register','RegisterController@register');
//登陆页面
Route::get('/login','LoginController@index')->name('login');
//登录行为
Route::post('/login','LoginController@pan');

Route::group(['middleware'=>'auth:web'],function(){

				//登出行为
				Route::get('/logout','LoginController@logout');
				//个人设置界面
				Route::get('user/me/setting','UserController@setting');
				//个人设置操作
				Route::post('user/me/setting','UserController@settingStore');




				//文章列表页
				Route::get('/posts','PostController@index');
				//文章详情页
				Route::get('/posts/{post}','PostController@show');
				//创建文章
				Route::get('/posts/{post}/create','PostController@create');
				Route::post('/posts','PostController@store');
				//编辑文章
				Route::get('/posts/{post}/edit','PostController@edit');
				Route::post('/posts/{post}/updatePost','PostController@update');
				//删除文章
				Route::get('/posts/delete','PostController@delete');
				// upload image
				Route::post('/posts/xxx/pan','PostController@pan');
				//show comment
				Route::post('/posts/{post_id}/comment','PostController@comment');
				// zan
				Route::get('/posts/{post}/zan','PostController@zan');
				// uzan
				Route::get('/posts/{post}/uzan','PostController@uzan');
				//home page
				Route::get('/user/{id}','UserController@show');
					//
				Route::post('/user/{id}/ufollow','UserController@ufollow');
				Route::post('/user/{id}/follow','UserController@follow');
				Route::get('/topic/{topic}','TopicController@index');
				Route::post('/topic/{topic}/submit','TopicController@submit');



});




include('admin.php');




// Route::get('/', function () {
//     return view('welcome');
// });
// Route::get('hello',  'HelloController@hello');


// Route::get('hello/{name}', 'HelloController@sayhello')->middleware('checkName');


// Route::get('admin/test1','Admin\testController@test1');


// Route::namespace('Admin')->prefix('admin')->middleware('checkName')->group(function(){


// 		Route::get('test1/{name}','testController@test1');


// });